@page "/pdf/find-pdf-corruption"
@inject Microsoft.JSInterop.IJSRuntime JS
@using System.IO
@using Syncfusion.Blazor.Buttons
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment
@inherits SampleBaseComponent;
@*Hidden:Lines*@

@using BlazorDemos.Data.FileFormats.PDF

@*End:Hidden*@

<SampleDescription>
    <p>This sample demonstrates how to find PDF document corruption by using Essential PDF.</p>
</SampleDescription>
<ActionDescription>
   <p>This feature allows you to find only PDF syntax level corruptions.</p>
</ActionDescription>

<div class="control-section">
    <p style="font-weight:normal">Click the button to view a PDF document validation result generated by Essential PDF. </p>

    <div class="button-section">
        <div id="button-control">
            <div class="row">
                <div>
                    <SfButton @onclick="FindPDFCorruptionPDF">Validate PDF</SfButton>
                </div>
            </div>
        </div>
    </div>
    <div style="margin-top: 10px">
        <text for="skills" style="font-weight:bold">Validation Result</text><br><br>
        <textarea name="skills" cols="100" rows="5" readonly="readonly">@response</textarea>
    </div>
</div>

<style>
    .radio-control {
        margin: 0 0 5% 0;
    }

    .control-section .row {
        margin: 10px 0;
    }
</style>

@code {   
    
	string response = null;
    /// <summary>
    ///  Find the corruptions in PDF document.
    ///<summary>
    protected void FindPDFCorruptionPDF(MouseEventArgs args)
    {	            
        FindPDFCorruptionService service = new FindPDFCorruptionService(hostingEnvironment);
        response = service.FindPDFCorruptionPDF();
    }
}
